From: Robert Lipe Date: Mon, 3 Dec 2018 06:16:39 +0000 (-0600) Subject: Remove unneeded const qualifier on pass-by-value types. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~8^2~51^2~13 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22Program/%22http:/www.example.com/cgi/%22https:/%22Program?a=commitdiff_plain;h=3a98efaa27ddb2d73574220477c0c8a99d77e828;p=gpsbabel.git Remove unneeded const qualifier on pass-by-value types. --- diff --git a/cet.h b/cet.h index d1333211c..95e183964 100644 --- a/cet.h +++ b/cet.h @@ -54,22 +54,22 @@ int cet_ucs4_to_utf8(char* dest, size_t dest_size, int value); /* single char/value transmission - vec based */ -int cet_char_to_ucs4(const char src, const cet_cs_vec_t* vec, int* value); +int cet_char_to_ucs4(char src, const cet_cs_vec_t* vec, int* value); short cet_utf8_to_char(const char* str, const cet_cs_vec_t* vecint, int* bytes, int* value); -short cet_ucs4_to_char(const int value, const cet_cs_vec_t* vec); +short cet_ucs4_to_char(int value, const cet_cs_vec_t* vec); /* string to string - vector based */ char* cet_str_utf8_to_any(const char* src, const cet_cs_vec_t* vec); char* cet_str_any_to_utf8(const char* src, const cet_cs_vec_t* vec); -char* cet_str_uni_to_utf8(const short* src, const int length); +char* cet_str_uni_to_utf8(const short* src, int length); /* UTF-8 string manipulation functions */ unsigned int cet_utf8_strlen(const char* str); char* cet_utf8_strdup(const char* str); -char* cet_utf8_strndup(const char* str, const int maxlen); +char* cet_utf8_strndup(const char* str, int maxlen); /* unicode functions */ diff --git a/cet_util.h b/cet_util.h index 4cc6a40d7..40810cd1c 100644 --- a/cet_util.h +++ b/cet_util.h @@ -63,7 +63,7 @@ const char* cet_convert_string(const QString& str); /* gpsbabel extensions */ -void cet_convert_init(const QString& cs_name, const int force); +void cet_convert_init(const QString& cs_name, int force); void cet_convert_strings(const cet_cs_vec_t* source, const cet_cs_vec_t* target, const char* format); void cet_convert_deinit(); diff --git a/csv_util.h b/csv_util.h index 92cce2a6a..b1b5e1d48 100644 --- a/csv_util.h +++ b/csv_util.h @@ -31,7 +31,7 @@ csv_stringtrim(const char* string, const char* enclosure, int strip_max); QString csv_stringtrim(const QString& source, const QString& enclosure); char* -csv_lineparse(const char* stringstart, const char* delimited_by, const char* enclosed_in, const int line_no); +csv_lineparse(const char* stringstart, const char* delimited_by, const char* enclosed_in, int line_no); void human_to_dec(const char* instr, double* outlat, double* outlon, int which); diff --git a/defs.h b/defs.h index b3c703422..ecdf1a535 100644 --- a/defs.h +++ b/defs.h @@ -575,8 +575,7 @@ void waypt_add_url(Waypoint* wpt, const QString& link, void waypt_add_url(Waypoint* wpt, const QString& link, const QString& url_link_text, const QString& url_link_type); -double gcgeodist(const double lat1, const double lon1, - const double lat2, const double lon2); +double gcgeodist(double lat1, double lon1, double lat2, double lon2); double waypt_time(const Waypoint* wpt); double waypt_distance_ex(const Waypoint* A, const Waypoint* B); double waypt_distance(const Waypoint* A, const Waypoint* B); @@ -849,7 +848,7 @@ void setshort_mustuniq(short_handle, int n); void setshort_whitespace_ok(short_handle, int n); void setshort_repeating_whitespace_ok(short_handle, int n); void setshort_defname(short_handle, const char* s); -void setshort_is_utf8(short_handle h, const int is_utf8); +void setshort_is_utf8(short_handle h, int is_utf8); #define ARGTYPE_UNKNOWN 0x00000000 #define ARGTYPE_INT 0x00000001 @@ -965,7 +964,7 @@ typedef struct style_vecs { extern style_vecs_t style_list[]; [[noreturn]] void fatal(const char*, ...) PRINTFLIKE(1, 2); -void is_fatal(const int condition, const char*, ...) PRINTFLIKE(2, 3); +void is_fatal(int condition, const char*, ...) PRINTFLIKE(2, 3); void warning(const char*, ...) PRINTFLIKE(1, 2); void debug_print(int level, const char* fmt, ...) PRINTFLIKE(2,3); @@ -978,7 +977,7 @@ void init_vecs(); void exit_vecs(); void disp_formats(int version); const char* name_option(long type); -void printposn(const double c, int is_lat); +void printposn(double c, int is_lat); void* xcalloc(size_t nmemb, size_t size); void* xmalloc(size_t size); @@ -1012,7 +1011,7 @@ inline int case_ignore_strncmp(const QString& s1, const QString& s2, int n) } int str_match(const char* str, const char* match); -QString strenquote(const QString& str, const QChar quot_char); +QString strenquote(const QString& str, QChar quot_char); char* strsub(const char* s, const char* search, const char* replace); char* gstrsub(const char* s, const char* search, const char* replace); @@ -1084,10 +1083,10 @@ unsigned int le_readu16(const void* ptr); signed int le_read32(const void* ptr); unsigned int le_readu32(const void* ptr); void le_read64(void* dest, const void* src); -void be_write16(void* ptr, const unsigned value); -void be_write32(void* ptr, const unsigned value); -void le_write16(void* ptr, const unsigned value); -void le_write32(void* ptr, const unsigned value); +void be_write16(void* ptr, unsigned value); +void be_write32(void* ptr, unsigned value); +void le_write16(void* ptr, unsigned value); +void le_write32(void* ptr, unsigned value); double endian_read_double(const void* ptr, int read_le); float endian_read_float(const void* ptr, int read_le); @@ -1129,23 +1128,23 @@ typedef enum { /* bit manipulation functions (util.c) */ -char gb_getbit(const void* buf, const uint32_t nr); -void gb_setbit(void* buf, const uint32_t nr); +char gb_getbit(const void* buf, uint32_t nr); +void gb_setbit(void* buf, uint32_t nr); -void* gb_int2ptr(const int i); +void* gb_int2ptr(int i); int gb_ptr2int(const void* p); /* * From parse.c */ -int parse_coordinates(const char* str, int datum, const grid_type grid, +int parse_coordinates(const char* str, int datum, grid_type grid, double* latitude, double* longitude, const char* module); -int parse_coordinates(const QString& str, int datum, const grid_type grid, +int parse_coordinates(const QString& str, int datum, grid_type grid, double* latitude, double* longitude, const char* module); int parse_distance(const char* str, double* val, double scale, const char* module); int parse_distance(const QString& str, double* val, double scale, const char* module); -int parse_speed(const char* str, double* val, const double scale, const char* module); -int parse_speed(const QString& str, double* val, const double scale, const char* module); +int parse_speed(const char* str, double* val, double scale, const char* module); +int parse_speed(const QString& str, double* val, double scale, const char* module); /* * From util_crc.c @@ -1165,14 +1164,14 @@ typedef enum { } fmt_units; int fmt_setunits(fmt_units); -double fmt_distance(const double, const char** tag); -double fmt_altitude(const double, const char** tag); -double fmt_speed(const double, const char** tag); +double fmt_distance(double, const char** tag); +double fmt_altitude(double, const char** tag); +double fmt_speed(double, const char** tag); /* * From nmea.c */ -int nmea_cksum(const char* const buf); +int nmea_cksum(const char*buf); /* * Color helpers. diff --git a/garmin_fs.h b/garmin_fs.h index 90db68de4..5ed4d0782 100644 --- a/garmin_fs.h +++ b/garmin_fs.h @@ -116,14 +116,14 @@ typedef struct garmin_fs_s { #endif } garmin_fs_t, *garmin_fs_p; -garmin_fs_t* garmin_fs_alloc(const int protocol); +garmin_fs_t* garmin_fs_alloc(int protocol); void garmin_fs_destroy(void* fs); void garmin_fs_copy(garmin_fs_t** dest, garmin_fs_t* src); void garmin_fs_convert(void* fs); char* garmin_fs_xstrdup(const char* src, size_t size); /* for GPX */ -void garmin_fs_xml_convert(const int base_tag, int tag, const QString& cdatastr, Waypoint* waypt); +void garmin_fs_xml_convert(int base_tag, int tag, const QString& cdatastr, Waypoint* waypt); class QXmlStreamWriter; void garmin_fs_xml_fprint(const Waypoint* waypt, QXmlStreamWriter*); @@ -137,7 +137,7 @@ unsigned char garmin_fs_merge_category(const char* category_name, Waypoint* wayp #define GMSD_SECTION_CATEGORIES "Garmin Categories" -void garmin_fs_garmin_after_read(const GPS_PWay way, Waypoint* wpt, const int protoid); -void garmin_fs_garmin_before_write(const Waypoint* wpt, GPS_PWay way, const int protoid); +void garmin_fs_garmin_after_read(GPS_PWay way, Waypoint* wpt, int protoid); +void garmin_fs_garmin_before_write(const Waypoint* wpt, GPS_PWay way, int protoid); #endif diff --git a/garmin_gpi.cc b/garmin_gpi.cc index 028c85c69..2a8c4d4ad 100644 --- a/garmin_gpi.cc +++ b/garmin_gpi.cc @@ -404,7 +404,7 @@ read_header() } /* gpi tag handler */ -static int read_tag(const char* caller, const int tag, Waypoint* wpt); +static int read_tag(const char* caller, int tag, Waypoint* wpt); /* read a single poi with all options */ diff --git a/garmin_tables.h b/garmin_tables.h index 21e7e0862..ff51fe576 100644 --- a/garmin_tables.h +++ b/garmin_tables.h @@ -36,7 +36,7 @@ typedef const struct icon_mapping { typedef enum {MAPSOURCE, PCX, GARMIN_SERIAL, GDB} garmin_formats_e; -const QString gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format); +const QString gt_find_desc_from_icon_number(int icon, garmin_formats_e garmin_format); int gt_find_icon_number_from_desc(const QString& desc, garmin_formats_e garmin_format); extern icon_mapping_t garmin_icon_table[]; @@ -89,16 +89,16 @@ typedef enum { unsigned char gt_convert_category(const char* name, int* category); -unsigned char gt_switch_display_mode_value(const unsigned char display_mode, const int protoid, const char device); +unsigned char gt_switch_display_mode_value(unsigned char display_mode, int protoid, char device); grid_type gt_lookup_grid_type(const char* grid_name, const QString& module); -const char* gt_get_mps_grid_longname(const grid_type grid, const char* module); +const char* gt_get_mps_grid_longname(grid_type grid, const char* module); int gt_lookup_datum_index(const char* datum_str, const QString& module); -const char* gt_get_mps_datum_name(const int datum_index); -uint32_t gt_color_value(const unsigned int garmin_index); +const char* gt_get_mps_datum_name(int datum_index); +uint32_t gt_color_value(unsigned int garmin_index); uint32_t gt_color_value_by_name(const QString& name); int gt_color_index_by_name(const QString& name); -int gt_color_index_by_rgb(const int rgb); -const char* gt_color_name(const unsigned int garmin_index); +int gt_color_index_by_rgb(int rgb); +const char* gt_color_name(unsigned int garmin_index); #endif diff --git a/gbfile.h b/gbfile.h index 10a0cad78..3a1b87bbc 100644 --- a/gbfile.h +++ b/gbfile.h @@ -88,8 +88,8 @@ gbfile* gbfopen_be(const QString& filename, const char* mode, const char* module #define gbfopen_le gbfopen void gbfclose(gbfile* file); -gbsize_t gbfread(void* buf, const gbsize_t size, const gbsize_t members, gbfile* file); -gbsize_t gbfread(QString& buf, const gbsize_t size, const gbsize_t members, gbfile* file); +gbsize_t gbfread(void* buf, gbsize_t size, gbsize_t members, gbfile* file); +gbsize_t gbfread(QString& buf, gbsize_t size, gbsize_t members, gbfile* file); int gbfgetc(gbfile* file); QString gbfgets(char* buf, int len, gbfile* file); @@ -97,7 +97,7 @@ int gbvfprintf(gbfile* file, const char* format, va_list ap); int gbfprintf(gbfile* file, const char* format, ...); int gbfputc(int c, gbfile* file); int gbfputs(const QString& s, gbfile* file); -int gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file); +int gbfwrite(const void* buf, gbsize_t size, gbsize_t members, gbfile* file); int gbfflush(gbfile* file); void gbfclearerr(gbfile* file); @@ -106,7 +106,7 @@ void gbfrewind(gbfile* file); int gbfseek(gbfile* file, int32_t offset, int whence); gbsize_t gbftell(gbfile* file); int gbfeof(gbfile* file); -int gbfungetc(const int c, gbfile* file); +int gbfungetc(int c, gbfile* file); int32_t gbfgetint32(gbfile* file); #define gbfgetuint32 (uint32_t)gbfgetint32 @@ -119,13 +119,13 @@ QString gbfgetpstr(gbfile* file); // read a pascal string QString gbfgetcstr(gbfile* file); // read a null terminated string char* gbfgetcstr_old(gbfile* file); // read a null terminated string -int gbfputint16(const int16_t i, gbfile* file); +int gbfputint16(int16_t i, gbfile* file); #define gbfputuint16(a,b) gbfputint16((uint16_t)(a),(b)) -int gbfputint32(const int32_t i, gbfile* file); +int gbfputint32(int32_t i, gbfile* file); #define gbfputuint32(a,b) gbfputint32((uint32_t)(a),(b)) -int gbfputdbl(const double d, gbfile* file); // write a double value -int gbfputflt(const float f, gbfile* file); // write a float value +int gbfputdbl(double d, gbfile* file); // write a double value +int gbfputflt(float f, gbfile* file); // write a float value int gbfputcstr(const QString& s, gbfile* file); // write string including '\0' diff --git a/ggv_ovl.cc b/ggv_ovl.cc index a837598d0..9fbcd8b0f 100644 --- a/ggv_ovl.cc +++ b/ggv_ovl.cc @@ -203,7 +203,7 @@ static void waypt_disp_cb(const Waypoint* wpt); static void track_disp_cb(const route_head* trk); static void route_disp_cb(const route_head* rte); static void write_bounds(); -static void draw_symbol_basics(const OVL_SYMBOL_TYP typ, const int art, const OVL_COLOR_TYP color, const Waypoint* wpt); +static void draw_symbol_basics(OVL_SYMBOL_TYP typ, int art, OVL_COLOR_TYP color, const Waypoint* wpt); static int get_direction(const Waypoint* A, const Waypoint* B); // static void draw_symbol_text(const char *text, const waypoint *reference); diff --git a/inifile.h b/inifile.h index 911633192..ab263e9d0 100644 --- a/inifile.h +++ b/inifile.h @@ -59,6 +59,6 @@ int inifile_readint(const inifile_t* inifile, const char* section, const char* k inifile_readint_def: if found inifile_readint_def returns value of key, otherwise a default value "def" */ -int inifile_readint_def(const inifile_t* inifile, const char* section, const char* key, const int def); +int inifile_readint_def(const inifile_t* inifile, const char* section, const char* key, int def); #endif diff --git a/jeeps/gpsmath.h b/jeeps/gpsmath.h index 3a555ce88..17e44cbd5 100644 --- a/jeeps/gpsmath.h +++ b/jeeps/gpsmath.h @@ -111,9 +111,9 @@ double N, int32 zone, char zc); int32 GPS_Math_Known_Datum_To_UTM_EN(double lat, double lon, double* E, - double* N, int32* zone, char* zc, const int n); + double* N, int32* zone, char* zc, int n); int32 GPS_Math_UTM_EN_To_Known_Datum(double* lat, double* lon, double E, - double N, int32 zone, char zc, const int n); + double N, int32 zone, char zc, int n); void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double* E, double* N,double phi0,double lambda0, @@ -137,11 +137,11 @@ void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double* lat, double* lon); void GPS_Math_UTM_EN_to_LatLon(int ReferenceEllipsoid, - const double UTMNorthing, const double UTMEasting, + double UTMNorthing, double UTMEasting, double* Lat, double* Lon, - const double lambda0, const double E0, const double N0); + double lambda0, double E0, double N0); int32 GPS_Lookup_Datum_Index(const char* n); - const char* GPS_Math_Get_Datum_Name(const int datum_index); + const char* GPS_Math_Get_Datum_Name(int datum_index); #endif diff --git a/jeeps/gpsutil.h b/jeeps/gpsutil.h index 15d70ec9f..2421d61e7 100644 --- a/jeeps/gpsutil.h +++ b/jeeps/gpsutil.h @@ -7,16 +7,16 @@ int32 GPS_Util_Little(); US GPS_Util_Get_Short(const UC* s); - void GPS_Util_Put_Short(UC* s, const US v); + void GPS_Util_Put_Short(UC* s, US v); int32 GPS_Util_Get_Int(const UC* s); - void GPS_Util_Put_Int(UC* s, const int32 v); + void GPS_Util_Put_Int(UC* s, int32 v); double GPS_Util_Get_Double(const UC* s); - void GPS_Util_Put_Double(UC* s, const double v); + void GPS_Util_Put_Double(UC* s, double v); float GPS_Util_Get_Float(const UC* s); - void GPS_Util_Put_Float(UC* s, const float v); + void GPS_Util_Put_Float(UC* s, float v); void GPS_Util_Canon(int32 state); int32 GPS_Util_Block(int32 fd, int32 state); - void GPS_Util_Put_Uint(UC* s, const uint32 v); + void GPS_Util_Put_Uint(UC* s, uint32 v); uint32 GPS_Util_Get_Uint(const UC* s); void GPS_Warning(const char* s); diff --git a/magellan.h b/magellan.h index 4b9208f5b..e681a865c 100644 --- a/magellan.h +++ b/magellan.h @@ -53,7 +53,7 @@ typedef struct icon_mapping { QString mag_find_descr_from_token(const char* token); QString mag_find_token_from_descr(const QString& icon); -unsigned int mag_checksum(const char* const buf); +unsigned int mag_checksum(const char*buf); QString m330_cleanse(const char* istring); Waypoint* mag_trkparse(char* trkmsg); diff --git a/trackfilter.h b/trackfilter.h index 7c0ca79e7..8e0132524 100644 --- a/trackfilter.h +++ b/trackfilter.h @@ -192,7 +192,7 @@ private: void trackfilter_minpoint_list_cb(const route_head* track); void trackfilter_split_init_rte_name(route_head* track, const QDateTime& dt); - void trackfilter_pack_init_rte_name(route_head* track, const time_t default_time); + void trackfilter_pack_init_rte_name(route_head* track, time_t default_time); void trackfilter_title();